const express = require('express');
const router = express.Router();

router.get('/', (req, res) => {
    const content = [];
    for(let i = 0; i < 40; i++) content.push({
        id: `${i + 1}`,
        code: `201900${i}`,
        name: `JXSMC00${i}`,
        status: 1,
        engName: `Eng${i}`,
        address: `address${i}`,
        contactNumber: 'string',
        fax: 'string',
        remark: 'string',
        rowVersion: 'string',
        options: [
            'abandon',
            'update'
        ]
    });
    res.json({
        message: '',
        payload: {
            content,
            totalElements: 40,
        }
    });
});

router.get('/:id', (req, res) => {
    res.json({
        message: 'string',
        payload: {
            id: '1',
            code: '2019001',
            name: 'JXSMC001',
            remark: 'stringst',
            creatorName: 'string',
            engName: 'Eng1',
            address: 'address1',
            contactNumber: 'string',
            fax: 'string',
            status: 1,
            createTime: '2019-06-16T09:26:17.025Z',
            modifierName: 'ASDADSADWQEQWEQWEQWE',
            modifyTime: '2019-06-23T09:26:17.025Z',
            abandonerName: 'string',
            abandonTime: '2019-07-16T09:26:17.025Z',
            rowVersion: 'string',
            options: [
                'abandon',
                'update'
            ],
            logoAttachments: [{
                fileId: 'te1232-131232-1we',
                fileName: '安装背景图1'
            },
            {
                fileId: 'qww1-232131-12e',
                fileName: '安装背景图2'
            }],
            signatureAttachments: [{
                fileId: 'te1232-131232-1we',
                fileName: '安装背景图1'
            },
            {
                fileId: 'qww1-232131-12e',
                fileName: '安装背景图2'
            }]
        }
    });
});

router.post('/', (req, res) => {
    res.json({
        message: '新增成功'
    });
});

router.put('/:id', (req, res) => {
    res.json({
        message: '编辑成功'
    });
});

router.put('/:id/abandon', (req, res) => {
    res.json({
        message: '作废成功'
    });
});

module.exports = router;
